package models

import (
	"time"
	"github.com/astaxie/beego/orm"
)

type Devices struct {
	Id                  int
	DeviceName          string        `ht:"list;search;name(设备名称)"  valid:"Required"`
	DeviceSN            string        `ht:"list;name(SN码)" valid:"Required"`
	DeviceType          int `ht:"list;name(设备类型);subclass([{\"Num\":1,\"Name\":\"烟雾传感器\"},{\"Num\":2,\"Name\":\"可燃气\"},{\"Num\":3,\"Name\":\"热成像\"},{\"Num\":4,\"Name\":\"节点电压\"},{\"Num\":5,\"Name\":\"温度监控\"},{\"Num\":6,\"Name\":\"消防用水\"},{\"Num\":7,\"Name\":\"边界入侵\"}])"`
	DeviceStatus	    int `orm:"default(0)" ht:"list;name(设备状态);status([{\"Num\":0,\"Name\":\"初始化\"},{\"Num\":1,\"Name\":\"正常运行\"},{\"Num\":2,\"Name\":\"维修检测\"},{\"Num\":3,\"Name\":\"故障\"}])"`
	DeviceTopic         string        `ht:"name(topic)"`
	DeviceCreateTime    time.Time        `ht:"list;name(创建时间)"`
	DeviceUpdateTime    time.Time        `ht:"name(更新时间)"`
	DeviceAuthName      string  `ht:"name(authName)"`
	DeviceAuthPass      string  `ht:"name(authPass)"`
	DevicePosition      string        `ht:"list;name(地点)"`
	DeviceLatitude      float64 `ht:"name(纬度)"`
	DeviceLongtitude    float64 `ht:"name(经度)"`
	AlarmValues         string  `ht:"name(报警值（分号分割，低程度报警在前，高程度在后）)"`
	DataUnit            string        `ht:"name(数据单位)"`
	WXPushGrade         int        `orm:"default(1)" ht:"name(微信预警推送等级，默认为1)"`
	WXPushInterval      int        `orm:"default(10)" ht:"name(微信预警推送时间间隔,以分钟为单位)"`
	MessagePushGrade    int        `orm:"default(2)" ht:"name(短信预警推送等级，默认为2)"`
	MessagePushInterval int        `orm:"default(10)" ht:"name(短信预警推送时间间隔,以分钟为单位)"`
	CallPushGrade       int        `orm:"default(3)" ht:"name(电话预警推送等级,默认为3)"`
	CallPushInterval    int        `orm:"default(15)" ht:"name(电话预警推送时间间隔,以分钟为单位)"`
	DevicePic           string        `ht:"name(设备图片);type(pic)"`
	User                int        `ht:"name(设备用户Id)"`
}

func init() {
	orm.RegisterModel(new(Devices))
}
func (*Devices)TableName() string {
	return "devices"
}

func (*Devices) FN_Id() string {
	return "Id"
}
func (*Devices) FN_DeviceName() string {
	return "DeviceName"
}
func (*Devices) FN_DeviceSN() string {
	return "DeviceSN"
}
func (*Devices) FN_DeviceType() string {
	return "DeviceType"
}
func (*Devices) FN_DeviceStatus() string {
	return "DeviceStatus"
}
func (*Devices) FN_DeviceTopic() string {
	return "DeviceTopic"
}
func (*Devices) FN_DeviceCreateTime() string {
	return "DeviceCreateTime"
}
func (*Devices) FN_DeviceUpdateTime() string {
	return "DeviceUpdateTime"
}
func (*Devices) FN_DeviceAuthName() string {
	return "DeviceAuthName"
}
func (*Devices) FN_DeviceAuthPass() string {
	return "DeviceAuthPass"
}
func (*Devices) FN_DevicePosition() string {
	return "DevicePosition"
}
func (*Devices) FN_DeviceLatitude() string {
	return "DeviceLatitude"
}
func (*Devices) FN_DeviceLongtitude() string {
	return "DeviceLongtitude"
}
func (*Devices) FN_AlarmValues() string {
	return "AlarmValues"
}
func (*Devices) FN_DataUnit() string {
	return "DataUnit"
}
func (*Devices) FN_WXPushGrade() string {
	return "WXPushGrade"
}
func (*Devices) FN_WXPushInterval() string {
	return "WXPushInterval"
}
func (*Devices) FN_MessagePushGrade() string {
	return "MessagePushGrade"
}
func (*Devices) FN_MessagePushInterval() string {
	return "MessagePushInterval"
}
func (*Devices) FN_CallPushGrade() string {
	return "CallPushGrade"
}
func (*Devices) FN_CallPushInterval() string {
	return "CallPushInterval"
}
func (*Devices) FN_DevicePic() string {
	return "DevicePic"
}
func (*Devices) FN_User() string {
	return "User"
}